export default {
    fetch: ({ url, method, data }) => {
      return new Promise((resolve, reject) => {
        const baseUrl = 'https://hongxingjiankangxcx.pangukj.com/index.php/'
        // const accessToken = wx.getStorageSync('accessToken')
        const accessToken = '39f9de7648717c28308e0900ae8a15b1'
        console.log('accessToken', accessToken)
        const headers = {
          'Content-Type': 'application/json; charset=utf-8',
          Authorization: 'Bearer 6d1b904efc937f6c36202fcbea878eee' // test
        }
  
        if (accessToken) {
          headers['Authorization'] = `Bearer ${accessToken}`
        }
  
        wx.request({
          url: `${baseUrl}${url}`,
          method,
          header: headers,
          data,
          success: res => {
            console.log(res)
            //         code: response.data.errorCode,
            // msg: response.data?.result?.msg,
            // ...response.data
            resolve(res)
          },
          fail: err => {
            reject(err)
          }
        })
      })
    }
  }
  